package org.pku_uestc.hackathon.utils;

import java.text.Collator;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;

import org.pku_uestc.hackathon.bean.ContactInfo;

public class ContactComparator implements Comparator<ContactInfo> {

	public int compare(ContactInfo value1, ContactInfo value2) {
		String s1 = value1.getName();
		String s2 = value2.getName();
		return Collator.getInstance(Locale.CHINESE).compare(s1, s2);
	}

	public static List<ContactInfo> sort(List<ContactInfo> strList) {
		ContactComparator comp = new ContactComparator();
		Collections.sort(strList, comp);
		return strList; // 返回排序后的列表
	}

}
